package com.gitee.feizns.zxw.web.controller.api;

import com.gitee.feizns.web.domain.result.Ret;
import com.gitee.feizns.web.mvc.validate.annotation.Exists;
import com.gitee.feizns.zxw.domain.pojo.PagePcTopicAreas;
import com.gitee.feizns.zxw.domain.portal.vo.page.pc.topic.areas.DetailsVo;
import com.gitee.feizns.zxw.service.api.ApiPagePcTopicAreasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 专题页 => 区域
 * @author feizns
 * @since 2019/9/9
 */
@Validated
@RestController
@RequestMapping("/api/v1/portal/page/pc/topic/areas")
public class ApiPagePcTopicAreasController {

    @Autowired
    private ApiPagePcTopicAreasService apiPagePcTopicAreasService;

    /**
     * 区域
     *
     * 错误码
     * [source]
     * ----
     * 4462     PAGE_PC_TOPIC_AREAS_NOT_FOUND       //区域专题找不到
     * ----
     * @return com.gitee.feizns.zxw.domain.portal.vo.page.pc.topic.areas.FirstVo
     */
    @GetMapping("/{id}")
    public Ret<DetailsVo> details(@PathVariable @Exists(PagePcTopicAreas.class) Integer id) {
        return Ret.ok(apiPagePcTopicAreasService.details(id));
    }

}
